 import React from "react";

class WeatherSimple extends React.Component{
  // 初始化状态
  state = {
    isHot: true
  }

  render() {
    const {isHot} = this.state
    return (
      <h2 onClick={this.changeWeather}>今天天气很{`${isHot ? '炎热' : '凉爽'}`}</h2>
    )
  }
  // 自定义方法 -- 要用赋值语句+箭头函数
  changeWeather = () => {
    const {isHot} = this.state
    this.setState({
      isHot: !isHot
    })
  }
}

export default WeatherSimple
